<!-- navbar -->
<nav class="navbar navbar-default navbar-fixed-top custom-no-margin">
  <div class="container">
    <div class="navbar-header">
      <a href="{{ '/' | prepend: site.baseurl }}" class="navbar-brand">
        <img src="{{ '/assets/images/logo/marlin/text-25.png' | prepend: site.baseurl }}" alt="Marlin" />
      </a>
      <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>

    <div class="navbar-collapse collapse" id="navbar-main">
      <ul class="nav navbar-nav">
        <li class="dropdown">
          <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="navbar-getting-started">
            Getting Started <span class="caret"></span>
          </a>

          <ul class="dropdown-menu">
            <li><a href="{{ '/docs/basics/introduction.html' | prepend: site.baseurl }}">
              Introduction
            </a></li>

            <li class="divider"></li>

            <li><a href="{{ '/meta/download/' | prepend: site.baseurl }}">
              Download Marlin
            </a></li>

            <li><a href="{{ '/docs/basics/install.html' | prepend: site.baseurl }}">
              Installing Marlin
            </a></li>

            <li><a href="{{ '/docs/configuration/configuration.html' | prepend: site.baseurl }}">
              Configuring Marlin
            </a></li>

            <li class="divider"></li>

            <li><a href="{{ '/docs/basics/reporting_bugs.html' | prepend: site.baseurl }}">
              Reporting bugs
            </a></li>
          </ul>
        </li>

        <li><a href="{{ '/meta/download/' | prepend: site.baseurl }}">
          Download
        </a></li>

        <li class="dropdown">
          <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="navbar-documentation">
            Documentation <span class="caret"></span>
          </a>
          <ul class="dropdown-menu">
            {% assign list = ('' | split: '|') %}
            {% for col in site.collections %}
              {% if col.title %}
                {% assign list = list | push: col %}
              {% endif %}
            {% endfor %}

            {% if list.size > 0 %}
              {% assign list = (list | sort: 'title') %}
              {% for col in list %}
                {% if col.title %}
                    <li class="dropdown-submenu {{ col.label }}">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ col.title }}</a>
                      <ul class="dropdown-menu">
                        <li><a href="{{ '/meta/' | append: col.label | append: '/' | prepend: site.baseurl }}">
                          All documents
                        </a></li>
                        {% if col.label == 'gcode' %}
                          <li class="divider"></li>
                          {% assign docs = (col.docs | sort: 'tag') %}
                          {% for doc in docs %}
                            {% if doc.title %}
                              <li><a href="{{ doc.url | prepend: site.baseurl }}">
                                {% if col.label == 'gcode' %}
                                  {{ doc.codes[0] }}{% if doc.codes[1] %}-{{ doc.codes[1] }}{% endif %}: {{ doc.title }}
                                {% else %}
                                  {{ doc.title }}
                                {% endif %}
                              </a></li>
                            {% endif %}
                          {% endfor %}
                        {% else %}
                          {% assign docs = (col.docs | group_by: 'tag' | sort: 'title') %}
                          {% for tag in docs %}
                            <li class="divider"></li>
                            {% for doc in tag.items %}
                              {% if doc.title %}
                                <li><a href="{{ doc.url | prepend: site.baseurl }}">
                                  {% if col.label == 'gcode' %}
                                    {{ doc.codes[0] }}{% if doc.codes[1] %}-{{ doc.codes[1] }}{% endif %}: {{ doc.title }}
                                  {% else %}
                                    {{ doc.title }}
                                  {% endif %}
                                </a></li>
                              {% endif %}
                            {% endfor %}
                          {% endfor %}
                        {% endif %}
                      </ul>
                    </li>
                  {% endif %}
                {% endfor %}
              {% endif %}

            <li class="divider"></li>

            <li><a href="{{ '/meta/needs-review/' | prepend: site.baseurl }}">
              Documentation Needing Review
            </a></li>
          </ul>
        </li>

        <li class="dropdown">
          <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="navbar-tools">
          Tools <span class="caret"></span></a>

          <ul class="dropdown-menu">
            <li><a href="{{ '/tools/u8glib/converter.html' | prepend: site.baseurl }}">
              Customize the Bootscreen
            </a></li>
			
            <li><a href="{{ '/tools/lin_advance/k-factor.html' | prepend: site.baseurl }}">
              K-Factor Calibration Pattern
            </a></li>

            <li class="divider"></li>

            <li><a href="https://github.com/MarlinFirmware/Marlin/issues">
              Bugtracker
            </a></li>

            <li><a href="{{ '/docs/basics/reporting_bugs.html' | prepend: site.baseurl }}">
              Reporting bugs
            </a></li>

            <li class="divider"></li>

            <li><a href="https://github.com/MarlinFirmware/Marlin">
              Source Code Repository
            </a></li>
          </ul>
        </li>
      </ul>
{% if page.collection %}
      <ul class="nav navbar-nav navbar-right visible-lg-block">
        <li><a href="{{ site.repository.doc }}/edit/master/{{ page.path }}" data-proofer-ignore>
          <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
          <span>Improve this page</span>
        </a></li>
      </ul>
{% else %}
      <ul class="nav navbar-nav navbar-right visible-lg-block">
        <li>
          <a href="https://twitter.com/MarlinFirmware" class="twitter-follow-button" data-show-count="false">Follow @MarlinFirmware</a><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
        </li>
      </ul>
{% endif %}
    </div>
  </div>
</nav>
<!-- /navbar -->
